const webpack = require("webpack");
const path = require("path");
function resolve(dir) {
  return path.join(__dirname, dir);
}
let now = new Date();
let versionStr =
  "swork." +
  now.getFullYear() +
  getTen(now.getMonth() + +1) +
  getTen(now.getDate()) +
  "." +
  getTen(now.getHours()) +
  getTen(now.getMinutes()) +
  getTen(now.getSeconds());
versionStr = '"' + versionStr + '"';
function getTen(num) {
  if (num < 10) {
    return "0" + num;
  }
  return num;
}
module.exports = {
  publicPath: "/swork",
  productionSourceMap: false,
  configureWebpack: {
    plugins: [
      new webpack.DefinePlugin({
        VERSION: versionStr,
      }),
    ],
  },
  chainWebpack: (config) => {
    config.resolve.alias
      .set("@", resolve("src"))
      .set("js", resolve("src/assets/js"))
      .set("style", resolve("src/assets/css"));
  },
};
